package com.gzyj.jtt808.v2013.model.position.additionalInfo;



import com.gzyj.jtt808.utils.HexBytesUtil;
import com.gzyj.jtt808.v2011.additionalinfo.JTT808_AddtionalInfo;
import io.netty.buffer.ByteBuf;
import lombok.Data;

import java.io.Serializable;

/**
 * 扩展车辆信号状态位
 * @author lhj
 */
@Data
public class JTT808_0x0200_0x25 extends JTT808_AddtionalInfo implements Serializable {

    private Integer CarSignalStatus;


    public JTT808_0x0200_0x25() {
        this.setID(0x25);
        this.setLength(4);
    }

    @Override
    public void encode(ByteBuf buf) {
        buf.writeByte(this.getID());
        buf.writeByte(this.getLength());
        buf.writeInt(this.CarSignalStatus);
    }

    @Override
    public JTT808_0x0200_0x25 decode(ByteBuf buf) {
        byte[] temp= HexBytesUtil.readByOffset(buf,1);
        this.setLength(Integer.parseInt(HexBytesUtil.bytesToHex(temp),16));
        this.CarSignalStatus=buf.readInt();
        return this;
    }

}
